package com.luoqiz.project.qq.server.threads;

import java.io.BufferedOutputStream;
import java.io.IOException;

import com.luoqiz.project.qq.server.ServerAppMain;


public class BroadcastThread extends Thread{

	private String msg;
	public BroadcastThread(String msg){
		this.msg=msg;
	}
	@Override
	public void run() {
		ServerAppMain.sessionMap.forEach((k,v)->{
			try {
				BufferedOutputStream a = new BufferedOutputStream(v.getOutputStream());
				a.write(("广播消息："+msg).getBytes());
				a.flush();
			} catch (IOException e) {
				e.printStackTrace();
			}
		});
	}
}
